import os

# https://pybind11.readthedocs.io/en/stable/basics.html

ydmm='api.cpp'#要编译的源代码文件名字
mkm='cworld'#模块名

# order='cd '+os.getcwd()+'/world'
# print(order)
# os.system(order)
# g++ -o iou.so -I include  -std=c++11 -O3 -I/opt/conda/include/python3.6m -I/opt/conda/include/python3.6m  -Wno-unused-result -Wsign-compare -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -O3 -ffunction-sections -pipe  -fdebug-prefix-map=/tmp/build/80754af9/python_1564510748219/work=/usr/local/src/conda/python-3.6.9 -fdebug-prefix-map=/opt/conda=/usr/local/src/conda-prefix -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -flto -DNDEBUG -fwrapv -O3 -Wall -L/opt/conda/lib/python3.6/config-3.6m-x86_64-linux-gnu -L/opt/conda/lib -lpython3.6m -lpthread -ldl  -lutil -lrt -lm  -Xlinker -export-dynamic iou.cpp include/clipper/clipper.cpp --shared -f
order='cd cworld && '+'g++  -fPIC $(python3 -m pybind11 --includes) {} -O3 -Wall -shared -std=c++11 -o {}$(python3-config --extension-suffix)'.format(ydmm,mkm)
print(order)
if os.system(order):
    print('编译失败~')
else:
    print('编译成功！！！')